HAL Common How to Use ¶
- group HAL_How_To_Use
-
How to use the HAL module driver ¶
The HAL module (also called HAL generic) can be used as follows: ¶
This module provides 4 sets of APIs that allows to:
Initialize and De-Initialize the HAL module:
To initialize the HAL module, use the HAL_Init() function to:
Make device ready for other HAL modules operation. It configures:
HAL time base with default parameters: HAL tick from SysTick, interrupt enable, period 1ms
System generic features (NVIC priority grouping configuration, …)
To de-initiliaze the HAL module,use the HAL_DeInit() can be called (optional) to revert HAL configuration.
The HAL_InitTick() function is called by HAL_Init() with HAL default parameters and by HAL RCC when system clock is updated. User can call it from application with different parameters. User can override it (function declared as __WEAK) to use HAL tick with different clock source (timer, RTC, …)
The HAL_UpdateCoreClock() function updates the SystemCoreClock global variable.
Manage the HAL tick: Several APIs are available to manage the HAL tick:
Increment and get the uwTick global variable value:
This functionality is provided by HAL_IncTick() function.
This function is declared as __WEAK to be overridden in case of other implementations in user file.
Get the tick interrupttion priority and frequency:
This functionalities are provided by HAL_GetTickPrio() and HAL_GetTickFreq() functions.
Provide a delay in milliseconds:
This functionality is provided by HAL_Delay() function.
This function is declared as __WEAK to be overridden in case of other implementations in user file.
provide minimum delay in milliseconds based without Systick interrupt:
This functionality is provided by HAL_Delay_NoISR() function.
This function is declared as __WEAK to be overridden in case of other implementations in user file.
Suspend and resume the tick incrementation:
This functionalities are provided by HAL_SuspendTick() and HAL_ResumeTick() functions.
Get the HAL driver version:
This functionality is provided by HAL_GetVersion() function.
Get the device identification data:
This functionality is provided by HAL_GetDeviceUniqueID() function.